//
//  CPADataBaseManager.h
//  CloudPhotoAlbumSDK
//
//  Created by 瞿衡 on 16/12/2.
//  Copyright © 2016年 ND. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <FMDB/FMDB.h>

@interface BZDataBaseManager : NSObject


/**************************************************创建方法**************************************************/

+ (FMDatabaseQueue *)initialDbByName:(NSString *)dbName
                          tableNames:(NSArray <NSString *>*)tableNames
                       tableVersions:(NSArray *)tableVersions
                         tableModels:(NSArray *)tableModels
                            outError:(NSError *__autoreleasing *)outError;

/**************************************************更新方法**************************************************/


+ (void)updateDataBaseByModelAsync:(id)model
                            dbName:(NSString *)dbName
                         tableName:(NSString *)tableName
                      conditionSql:(NSString *)conditionSql
                           success:(void (^)(BOOL bSucced))success
                           failure:(void (^)(NSError *error))failure;

/**************************************************查询方法*************************************************/

/**
 *  查询当前登录用户的用户信息
 *
 *  @param outError 错误
 *
 *  @return 用户model
 */
+ (NSDictionary *)selectDataBaseSync:(NSString *)dbName
                           tableName:(NSString *)tableName
                     sqlConditionStr:(NSString *)conditionSql
                            outError:(NSError *__autoreleasing *)outError;

/**************************************************删除方法**************************************************/

+ (BOOL)deleteDataBaseBySync:(NSString *)dbName
                   tableName:(NSString *)tableName
             sqlConditionStr:(NSString *)conditionSql
                    outError:(NSError *__autoreleasing *)outError;

@end
